import java.util.Scanner;

public class Work03 {

    static boolean isPrime(int n ){
        if(n == 1){
            return false;
        }
        for (int i = 2; i <= Math.sqrt(n); i++) {
            if(n % i == 0){
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        // 给定一个正整数N，请你输出N 以内（不包含N）的质数以及质数的个数
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int count = 0;
        for (int i = 2; i < n; i++) {
            if(isPrime(i)){
                System.out.print(i+" ");
                count++;
            }
        }
        System.out.println();
        System.out.println(count);
    }
}
